<template>
  <el-select v-model="current" class="filter-item" clearable :placeholder="placeholder">
    <el-option v-for="item in datalist" :key="item.id" :label="item.name" :value="item.id" />
  </el-select>
</template>

<script>
  import waves from '@/directive/waves' // waves directive
  import Pagination from '@/components/Pagination'
  import {companyList} from "@/api/sys"; // secondary package based on el-pagination

  export default {
    name: 'companySelect',
    components: { Pagination },
    directives: { waves },
    filters: {

    },
    props:{
      value: String,
      placeholder: String
    },
    data() {
      return {
        datalist: []
      }
    },
    computed: {
      current: {
        set(newValue){
          this.$emit('input',newValue)
        },
        get(){
          return this.value
        }

      }
    },
    created() {
      this.companyListFun()
    },
    methods: {
      async companyListFun(){
        this.datalist = []
        await companyList({page: 1, limit: 10000, sort: '+id'}).then(response => {
          this.datalist = response.data.content
        })
      },
    }
  }
</script>

<style lang="scss" scoped>



</style>
